#define _CRT_SECURE_NO_WARNINGS 
#include <stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	int arr[100], brr[100];
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &arr[i]);
		brr[i] = 0;
	}
	int t = 0;
	for (int i = 0; i < n; i++)
	{
		for (int q = i + 1; q < n; q++)
		{
			for (int o = 0; o < n; o++)
			{
				if (arr[o] == arr[i] + arr[q] && brr[o] == 0)
				{
					t++;
					brr[o] = 1;
				}
			}
		}
	}
	printf("%d", t);
	return 0;
}